package com.leetcode.No0461;

/**
 * @program: leetcode
 * @description:
 * @author: wangzhihua
 * @date: 2021-05-29
 */
public class Solution {

	public int hammingDistance(int x, int y) {
		int ans = 0;
		int tmpNum = x ^ y;
		while (tmpNum > 0) {
			if ((tmpNum & 1) == 1) {
				++ans;
			}
			tmpNum >>= 1;
		}
		return ans;
	}

}
